package com.tqw.es.pojo;

import com.tqw.entity.BasePojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author Jim
 */
@Document(indexName = "tqw_items",shards = 3,replicas = 2)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Item extends BasePojo{
    @Id
    @Field(type = FieldType.Integer)
    private Integer id;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String title;

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String sellPoint;

    @Field(type = FieldType.Double)
    private BigDecimal price;

    @Field(type = FieldType.Keyword)
    private String fontImage;

    @Field(type = FieldType.Integer)
    private Integer catId;

    @Field(type = FieldType.Integer)
    private Integer grandfatherCatId;

    @Field(type = FieldType.Keyword)
    private Character status;

    @Field(type = FieldType.Integer)
    private Integer userId;

    @Field(type = FieldType.Integer)
    private Integer createBy;

    @Field(type = FieldType.Integer)
    private Integer updateBy;

    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createdTime;

    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updatedTime;
}
